package cn.kgc.service.impl;


import cn.kgc.dao.DetailsalaryDao;
import cn.kgc.dao.PaysalaryDao;
import cn.kgc.dao.PersonsalaryDao;
import cn.kgc.pojo.*;
import cn.kgc.service.Service_gzk;
import com.github.pagehelper.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

///////////////////////////            高振凯的         //////////////////////////////////////
@Service
public class ServiceImpl_gzk implements Service_gzk {
//paysalary 表

    @Resource
    private PaysalaryDao paysalaryDao;

//添加


    @Override
    public boolean addper(Integer paySalaryId,Integer payNumber, Integer headcount, Integer totalBasic, Integer realSalary, String payTime) {
        if (paysalaryDao.addpay(paySalaryId,payNumber,headcount, totalBasic, realSalary, payTime) > 0) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public Page<Paysalary> selAllPay() {
        return paysalaryDao.selAllPay();
    }

    @Override
    public List<Paysalary> selOne(Integer paySalaryId) {
        return paysalaryDao.selOne(paySalaryId);
    }
    //DetailsalaryDao 表 根据ID查询
    @Resource
    private DetailsalaryDao  detailsalaryDao;

    @Override
    public List<Detailsalary> selDeta(Integer paySalaryId) {
        return detailsalaryDao.selDeta(paySalaryId);
    }

    @Override
    public List<Detailsalary> DetaOne(Integer personnelId) {
        return detailsalaryDao.DetaOne(personnelId);
    }


    //PersonsalaryDao 表  根据ID查询
    @Resource
    private PersonsalaryDao personsalaryDao;

    @Override
    public List<Personsalary> selpers(Integer personnelId) {
        return personsalaryDao.selpers(personnelId);
    }

    @Override
    public boolean updper(Integer subsidiesId, String performance, String evection, String overtime, String deduct) {
        if (personsalaryDao.updper(subsidiesId,performance, evection, overtime, deduct) > 0) {
            return true;
        } else {
            return false;
        }
    }
}
